package cn.com.egova.erp.action;

import cn.com.egova.erp.biz.IReportBiz;
import cn.com.egova.erp.utils.FastJsonUtil;

import java.util.Date;
import java.util.List;

/**
 * Created by yuanchao on 2020/6/9.
 */
public class ReportAction {
    private IReportBiz reportBiz;
    private Date startDate;
    private Date endDate;
    private int year;

    public void setReportBiz(IReportBiz reportBiz) {
        this.reportBiz = reportBiz;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public void orderReport() {
        try {
            List list = reportBiz.ordersReport(startDate, endDate);
            FastJsonUtil.ajaxReturn(true, "获取报表数据成功!", list);
        } catch (Exception e) {
            e.printStackTrace();
            FastJsonUtil.ajaxReturn(false, "获取报表数据失败!", null);
        }
    }


    public void trendReport() {
        try {
            List list = reportBiz.getSumMoney(year);
            FastJsonUtil.ajaxReturn(true, "获取趋势数据成功!", list);
        } catch (Exception e) {
            e.printStackTrace();
            FastJsonUtil.ajaxReturn(true, "获取趋势数据成功!", null);
        }
    }
}
